﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;

namespace ObjectModel.PowerPoint.New
{
    public class LinkedSlideDictionary : SerializableDictionary<int, LinkedSlide>, INotifyPropertyChanged
    {
        LinkedSlide mActiveSlide;

        public event PropertyChangedEventHandler PropertyChanged;

        [XmlIgnore]
        public LinkedSlide ActiveSlide
        {
            get { return mActiveSlide; }

            set
            {
                mActiveSlide = value;
                OnPropertyChanged(new PropertyChangedEventArgs("ActiveSlide"));
            }
        }

        public new LinkedSlide this[int slideId]
        {
            get
            {
                if (!ContainsKey(slideId))
                    Add(slideId, new LinkedSlide());

                return base[slideId];
            }
        }

        protected void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }
    }
}
